home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Panorama / Panorama - Disk 01 (1986-02-15)(Pacific North-West Amigas Club)[h AFL][b corrupt files].zip / Panorama - Disk 01 (1986-02-15)(Pacific North-West Amigas Club)[h AFL][b corrupt files].adf / mand.c < prev    next >
Text File  |  1989-10-24  |  22KB  |  720 lines

  1. /*
  2.                     MAND.C - Command parsing
  3.             Mandelbrot's Self-Squared Dragon Generator
  4.                     For the Commodore Amiga
  5.                          Version 2.01
  6.  
  7.          Inspired by Scientific American, August/1985
  8.  
  9.            Corrections and improvements suggested by
  10.                   The Fractal Geometry of Nature
  11.      By Benoit Mandelbrot, W.H. Freeman and Company, 1983
  12.           (Used to be Z=Z^2+C, now is Z=Z^2-u, etc.)
  13.  
  14.              Copyright (C) 1985, Robert S. French
  15.             Vastly Enhanced by =RJ Mical=  1985/86
  16.             Copyright (C) 1986,  =Robert J. Mical=
  17.                  Placed in the Public Domain
  18.  
  19.  
  20. This program may be distributed free of charge as long as the above
  21. notice is retained.
  22.  
  23.  
  24. Programs should be compiled with:
  25.  
  26. 1> lc -i:include/ -i:include/lattice/ mand.c
  27. 1> lc -i:include/ -i:include/lattice/ mand1.c
  28. 1> lc -i:include/ -i:include/lattice/ mand2.c
  29. 1> lc -i:include/ -i:include/lattice/ mand3.c
  30. 1> lc -i:include/ -i:include/lattice/ mand4.c
  31. 1> lc -i:include/ -i:include/lattice/ mand5.c
  32. 1> lc -i:include/ -i:include/lattice/ mand6.c
  33. 1> lc -i:include/ -i:include/lattice/ mand7.c
  34. 1> alink :lib/Lstartup.obj+mand.o+mand1.o+mand2.o+mand3.o+mand4.o
  35.     +mand5.o+mand6.o+mand7.o to Mandelbrot lib :lib/lc.lib+:lib/amiga.lib
  36.  
  37. */
  38.  
  39.  
  40. /* ===========================================================================
  41.    ===========================================================================
  42. From: "french robert%d.mfenet"@LLL-MFE.ARPA
  43.  
  44. By the way, on a historical note, the "Mandelbrot Set" as related in
  45. Scientific American is a little different from the u-Map implemented
  46. here (as discussed in Mandelbrot's "The Fractal Geometry of Nature").
  47. The main difference is the use of Z <- Z^2+C in Scientific American vs.
  48. Z <- Z^2-u in the book and this program.  The primary effect is the reversal
  49. of the picture across the Y axis.
  50.  
  51. Enjoy!
  52.  
  53.                  Robert French
  54.                  French#Robert%d@LLL-MFE.ARPA
  55.  
  56.    ========================================================================
  57.    ======================================================================== */
  58.  
  59.  
  60. #include "mand.h"
  61.  
  62.  
  63. int MathBase,MathTransBase;
  64.  
  65.  
  66. /*----------------------*/
  67. /* Graphics definitions */
  68.  
  69. struct   GfxBase       *GfxBase;
  70. struct   IntuitionBase *IntuitionBase;
  71. struct   IconBase      *IconBase;
  72.  
  73. SHORT Color0, Color1, Color2;
  74. SHORT UserPalette[29];
  75.  
  76.  
  77. /*----------------------------------*/
  78. /* Miscellaneous Global Definitions */
  79.  
  80. union kludge {
  81.    float f;
  82.    int i;
  83. } start_r,end_r,start_i,end_i;
  84. int max_x,max_y,max_mem_y;
  85. int max_count,color_inc,color_offset,color_set,color_mode,color_div;
  86. int color_inset,func_num;
  87.  
  88. int v_starty,max_mem;
  89. long v_offset;
  90. UWORD *color_table,*v_mand_store;
  91.  
  92. int modified,want_read;
  93.  
  94. FILE *console,*v_fp = NULL,*redir_fp = NULL;
  95.  
  96. SHORT ZoomCenterX, ZoomCenterY, ZoomBoxSizeX, ZoomBoxSizeY;
  97. SHORT ZoomBoxStartX, ZoomBoxStartY;
  98.  
  99. int cur_resource = NULL;
  100.  
  101.  
  102. /*-------------*/
  103. /* Here we go! */
  104.  
  105. main()
  106. {
  107.    FILE *fopen();
  108.    char *fgets(),*stpblk();
  109.    float cnvf();
  110.    void anal_mand(),wait_close();
  111.  
  112.    int temp, y, i;
  113.    char *cmd,inp_buf[80],secchar,*argpos;
  114.    union kludge scale;
  115.    FILE *fp;
  116.  
  117.    max_mem_y = MAXMY;
  118.  
  119.    color_table = (UWORD *)malloc(4096*sizeof(UWORD));
  120.    if (color_table == NULL)
  121.       abort("Can't allocate memory for color table");
  122.    cur_resource |= F_COLORTAB;
  123.  
  124.    v_mand_store = (UWORD *)malloc(MAXX*max_mem_y*sizeof(UWORD));
  125.    if (v_mand_store == NULL)
  126.       abort("Can't allocate memory for set storage");
  127.    cur_resource |= F_SETSTORE;
  128.  
  129.    MathBase = OpenLibrary("mathffp.library",0);
  130.    if (MathBase < 1)
  131.       abort("Can't open mathffp.library");
  132.    cur_resource |= F_MATH;
  133.  
  134.    MathTransBase = OpenLibrary("mathtrans.library",0);
  135.    if (MathTransBase < 1)
  136.       abort("Can't open mathtrans.library");
  137.    cur_resource |= F_MATHTRANS;
  138.  
  139.    GfxBase = (struct GfxBase *)OpenLibrary("graphics.library",0);
  140.    if (GfxBase == NULL)
  141.       abort("Can't open graphics.library");
  142.    cur_resource |= F_GRAPHICS;
  143.  
  144.    IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",0);
  145.    if (IntuitionBase == NULL)
  146.       abort("Can't open intuition.library");
  147.    cur_resource |= F_INTUITION;
  148.  
  149.    IconBase = (struct IconBase *)OpenLibrary("icon.library",0);
  150.    if (IconBase == NULL)
  151.       abort("Can't open icon.library");
  152.    cur_resource |= F_ICON;
  153.  
  154.    console = fopen("con:0/0/640/200/Mandelbrot Commands","w+");
  155.    if (console == NULL)
  156.       abort("Can't open console window");
  157.    cur_resource |= F_CONSOLE;
  158.  
  159.    fprintf(console,
  160.       "Mandelbrot Self-Squared Dragon Generator - Version %s\n",VERSION);
  161.    fputs("Copyright (C) 1985, Robert S. French\n",console);
  162.    fputs(
  163.       "Vastly Enhanced (with Intuition!) by =RJ Mical=  1985/86\n",console);
  164.    fputs("Copyright (C) 1986, =Robert J. Mical=\n",console);
  165.    fputs("\n",console);
  166.    fputs(
  167.       "Placed in the public domain -- Read the source and learn!\n",console);
  168.    fputs("\n",console);
  169.    fputs("Type '?' or 'H' or <RETURN> for help\n\n",console);
  170.  
  171.    SetPresets(0);
  172.    Color0 = 0x22F;
  173.    Color1 = 0xFFF;
  174.    Color2 = 0x000;
  175.    for (i = 0; i <= 28; i++)
  176.       UserPalette[i] = ((i & 0xF) << 8) | ((i & 0xF) << 4) | ((i & 0xF) << 0);
  177.  
  178.    for (EVER) {
  179.  
  180. command:
  181.  
  182.       fprintf(console,"Command: ");
  183.       rewind(console);
  184.       if (redir_fp)
  185.          if (Chk_Abort()) {
  186.             fputs("\nRedirected input aborted!\n",console);
  187.             fclose(redir_fp);
  188.             redir_fp = NULL;
  189.          }
  190.          else {
  191.             cmd = fgets(inp_buf,78,redir_fp);
  192.             if (cmd == NULL) {
  193.                fputs("End of file encountered.\n",console);
  194.                fclose(redir_fp);
  195.                redir_fp = NULL;
  196.                cmd = fgets(inp_buf,40,console);
  197.             }
  198.             else
  199.                fputs(inp_buf,console);
  200.          }
  201.       else
  202.          cmd = fgets(inp_buf,40,console);
  203.       *(cmd+strlen(cmd)-1) = '\0';
  204.       secchar = toupper(*(cmd+1));
  205.       argpos = stpblk(cmd+2);
  206.       rewind(console);
  207.       switch (toupper(*cmd)) {
  208.          case 'I':
  209.             sscanf(argpos,"%d",&temp);
  210.             Information(temp);
  211.             goto command;
  212.          case 'S':
  213.             if (secchar == 'R') {
  214.                sscanf(argpos,"%f",&start_r.f);
  215.                start_r.i = SPFieee(start_r.i);
  216.                if (v_fp) {
  217.                   fclose(v_fp);
  218.                   v_fp = NULL;
  219.                }
  220.                goto command;
  221.             }
  222.             if (secchar == 'I') {
  223.                sscanf(argpos,"%f",&start_i.i);
  224.                start_i.i = SPFieee(start_i.i);
  225.                if (v_fp) {
  226.                   fclose(v_fp);
  227.                   v_fp = NULL;
  228.                }
  229.                goto command;
  230.             }
  231.             if (secchar == 'H') {
  232.                fputs("Current settings:\n",console);
  233.                CurrentSettings();
  234.                goto command;
  235.             }
  236.             if (secchar == 'A') {
  237.                fp = fopen(argpos,"w");
  238.                if (fp == NULL) {
  239.                   fprintf(console,"Cannot open file '%s'\n",argpos);
  240.                   goto command;
  241.                }
  242.                putc((char) 1,fp);
  243.                fwrite(&start_r,sizeof(start_r),1,fp);
  244.                fwrite(&start_i,sizeof(start_i),1,fp);
  245.                fwrite(&end_i,sizeof(end_i),1,fp);
  246.                fwrite(&max_x,sizeof(max_x),1,fp);
  247.                fwrite(&max_y,sizeof(max_y),1,fp);
  248.                want_read = TRUE;
  249.                for (y=0;y<max_y;y++) {
  250.                   v_pos_line(y);
  251.                   if(fwrite(v_mand_store+(y-v_starty)*max_x,
  252.                             max_x*sizeof(UWORD),1,fp) != 1) {
  253.                      fputs("Error while writing to file\n",console);
  254.                      break;
  255.                   }
  256.                }
  257.                fclose(fp);
  258.                goto command;
  259.             }
  260.             ill_cmd();
  261.             goto command;
  262.          case 'E':
  263.             if (secchar == 'R') {
  264.                sscanf(argpos,"%f",&end_r.i);
  265.                end_r.i = SPFieee(end_r.i);
  266.                if (v_fp) {
  267.                   fclose(v_fp);
  268.                   v_fp = NULL;
  269.                }
  270.                goto command;
  271.             }
  272.             if (secchar == 'I') {
  273.                sscanf(argpos,"%f",&end_i.i);
  274.                end_i.i = SPFieee(end_i.i);
  275.                if (v_fp) {
  276.                   fclose(v_fp);
  277.                   v_fp = NULL;
  278.                }
  279.                goto command;
  280.             }
  281.             ill_cmd();
  282.             goto command;
  283.          case 'M':
  284.             if (secchar == 'X') {
  285.                sscanf(argpos,"%d",&temp);
  286.                if (temp < 5 ||
  287.                      (temp > 320 && !(color_mode & 4)) ||
  288.                      (temp > 640 && (color_mode & 4))) {
  289.                   fputs("Illegal parameter!\n",console);
  290.                   goto command;
  291.                }
  292.                max_x = temp;
  293.                max_mem = max_mem_y * MAXX;
  294.                max_mem /= max_x;
  295.                if (v_fp) {
  296.                   fclose(v_fp);
  297.                   v_fp = NULL;
  298.                }
  299.                goto command;
  300.             }
  301.             if (secchar == 'Y') {
  302.                sscanf(argpos,"%d",&temp);
  303.                if (temp < 5 ||
  304.                      (temp > 200-STARTY && !(color_mode & 2)) ||
  305.                      (temp > 400-STARTY && (color_mode & 2))) {
  306.                   fputs("Illegal parameter!\n",console);
  307.                   goto command;
  308.                }
  309.                max_y = temp;
  310.                if (v_fp) {
  311.                   fclose(v_fp);
  312.                   v_fp = NULL;
  313.                }
  314.                goto command;
  315.             }
  316.             if (secchar == 'C') {
  317.                sscanf(argpos,"%d",&temp);
  318.                if (temp * color_inc + color_offset > 4095) {
  319.                   fputs("More than 4096 colors!\n",console);
  320.                   goto command;
  321.                }
  322.                if (temp < 2) {
  323.                   fputs("MaxCount must be greater than 1\n",console);
  324.                   goto command;
  325.                }
  326.                max_count = temp;
  327.                goto command;
  328.             }
  329.             if (secchar == 'M') {
  330.                sscanf(argpos,"%d",&temp);
  331.                if (temp < 5) {
  332.                   fputs("Number of lines must be >4!\n",console);
  333.                   goto command;
  334.                }
  335.                free(v_mand_store);
  336.                v_mand_store = (UWORD *)malloc(MAXX*temp*sizeof(UWORD));
  337.                if (v_mand_store == NULL) {
  338.                   fputs("Can't allocate that much memory for set storage",console);
  339.                   v_mand_store = (UWORD *)malloc(MAXX*max_mem_y*sizeof(UWORD));
  340.                   if (v_mand_store == NULL)
  341.                      abort("Can't reallocate memory!!!");
  342.                   goto command;
  343.                }
  344.                max_mem_y = temp;
  345.                if (v_fp) {
  346.                   fclose(v_fp);
  347.                   v_fp = NULL;
  348.                }
  349.                max_mem = MAXX * max_mem_y;
  350.                max_mem /= max_x;
  351.                goto command;
  352.             }
  353.             ill_cmd();
  354.             goto command;
  355.          case 'L':
  356.             if (v_fp) {
  357.                fclose(v_fp);
  358.                v_fp = NULL;
  359.             }
  360.             v_fp = fopen(stpblk(cmd+1),"r");
  361.             if (v_fp == NULL) {
  362.                fprintf(console,"Cannot open file '%s'\n",stpblk(cmd+1));
  363.                goto command;
  364.             }
  365.             if (getc(v_fp) != 1) {
  366.                fputs("File is not in proper format\n",console);
  367.                fclose(v_fp);
  368.                v_fp = NULL;
  369.                goto command;
  370.             }
  371.             fread(&start_r,sizeof(start_r),1,v_fp);
  372.             fread(&end_r,sizeof(end_r),1,v_fp);
  373.             fread(&start_i,sizeof(start_i),1,v_fp);
  374.             fread(&end_i,sizeof(end_i),1,v_fp);
  375.             fread(&max_x,sizeof(max_x),1,v_fp);
  376.             fread(&max_y,sizeof(max_y),1,v_fp);
  377.             v_offset = 25L;
  378.             modified = FALSE;
  379.             v_starty = max_mem+1;
  380.             want_read = TRUE;
  381.             v_pos_line(0);
  382.             goto command;
  383.          case 'X':
  384.             if (secchar == 'R') {
  385.                sscanf(argpos,"%f",&scale.f);
  386.                scale.i = SPFieee(scale.i);
  387.                start_r.i = SPAdd(start_r.i,scale.i);
  388.                end_r.i = SPAdd(end_r.i,scale.i);
  389.                if (v_fp) {
  390.                   fclose(v_fp);
  391.                   v_fp = NULL;
  392.                }
  393.                goto command;
  394.             }
  395.             if (secchar == 'I') {
  396.                sscanf(argpos,"%f",&scale.f);
  397.                scale.i = SPFieee(scale.i);
  398.                start_i.i = SPAdd(start_i.i,scale.i);
  399.                end_i.i = SPAdd(end_i.i,scale.i);
  400.                if (v_fp) {
  401.                   fclose(v_fp);
  402.                   v_fp = NULL;
  403.                }
  404.                goto command;
  405.             }
  406.             ill_cmd();
  407.             goto command;
  408.          case 'Z':
  409.             if (secchar != 'R' && secchar != 'I' && secchar != 'B') {
  410.                ill_cmd();
  411.                goto command;
  412.             }
  413.             if (v_fp) {
  414.                fclose(v_fp);
  415.                v_fp = NULL;
  416.             }
  417.             if (secchar != 'I' ) {
  418.                /* scale along the real axis */
  419.                sscanf(argpos,"%f",&scale.f);
  420.                ZoomAlongDarling(SPFieee(scale.i), SPFlt(1));
  421.             }
  422.             if (secchar != 'R') {
  423.                /* scale along the complex axis */
  424.                sscanf(argpos,"%f",&scale.f);
  425.                ZoomAlongDarling(SPFlt(1), SPFieee(scale.i));
  426.             }
  427.             goto command;
  428.          case 'C':
  429.             if (secchar == 'I') {
  430.                sscanf(argpos,"%d",&temp);
  431.                if (max_count * temp + color_offset > 4095) {
  432.                   fputs("More than 4096 colors!\n",console);
  433.                   goto command;
  434.                }
  435.                if (temp < 1) {
  436.                   fputs("Increment must be greater than 0!\n",console);
  437.                   goto command;
  438.                }
  439.                color_inc = temp;
  440.                goto command;
  441.             }
  442.             if (secchar == 'O') {
  443.                sscanf(argpos,"%d",&temp);
  444.                if (max_count * color_inc + temp > 4095) {
  445.                   fputs("More than 4096 colors!\n",console);
  446.                   goto command;
  447.                }
  448.                if (temp < 0) {
  449.                   fputs("Negative offset illegal!\n",console);
  450.                   goto command;
  451.                }
  452.                color_offset = temp;
  453.                goto command;
  454.             }
  455.             if (secchar == 'S') {
  456.                sscanf(argpos,"%d",&temp);
  457.                if (temp < 0 || temp > 2) {
  458.                   fputs("Illegal color set!\n",console);
  459.                   goto command;
  460.                }
  461.                color_set = temp;
  462.                init_colors();
  463.                goto command;
  464.             }
  465.             if (secchar == 'M') {
  466.                sscanf(argpos,"%d",&temp);
  467.                if (temp < 0 || temp > 7 || ((temp&4) && !(temp&1))) {
  468.                   fputs("Illegal graphics mode!\n",console);
  469.                   goto command;
  470.                }
  471.                color_mode = temp;
  472.                if (!(color_mode & 0x2))
  473.                   if (max_y > 200-STARTY)
  474.                      max_y = 200-STARTY;
  475.                if (!(color_mode & 0x4))
  476.                   if (max_x > 320)
  477.                      max_x = 320;
  478.                goto command;
  479.             }
  480.             if (secchar == 'D') {
  481.                sscanf(argpos,"%d",&temp);
  482.                if (temp < 1) {
  483.                   fputs("Divisor must be greater than 0!\n",console);
  484.                   goto command;
  485.                }
  486.                color_div = temp;
  487.                goto command;
  488.             }
  489.             if (secchar == 'T') {
  490.                sscanf(argpos,"%d",&temp);
  491.                if (temp < 0 || temp > 4095) {
  492.                   fputs("Color must be between 0 and 4095!\n",console);
  493.                   goto command;
  494.                }
  495.                color_inset = temp;
  496.                goto command;
  497.             }
  498.             ill_cmd();
  499.             goto command;
  500.          case 'F':
  501.             sscanf(stpblk(cmd+1),"%d",&temp);
  502.             if (temp < 0 || temp > 1) {
  503.                fputs("Function number must be 0 or 1!\n",console);
  504.                goto command;
  505.             }
  506.             func_num = temp;
  507.             goto command;
  508.          case 'P':
  509.             sscanf(stpblk(cmd+1),"%d",&temp);
  510.             SetPresets(temp);
  511.             goto command;
  512.          case 'D':
  513.             if (v_fp == NULL) {
  514.                fputs("Must <G>enerate or <L>oad first!\n",console);
  515.                goto command;
  516.             }
  517.             if (disp_mand() == NULL)
  518.                wait_close();
  519.             goto command;
  520.          case 'G':
  521.             if (gen_mand() == NULL)
  522.                wait_close();
  523.             goto command;
  524.          case 'A':
  525.             if (v_fp == NULL) {
  526.                fputs("Must <G>enerate or <L>oad first!\n",console);
  527.                goto command;
  528.             }
  529.             if (!(color_mode & 1)) {
  530.                fputs("Cannot be in hold and modify!\n",console);
  531.                goto command;
  532.             }
  533.             anal_mand();
  534.             goto command;
  535.          case ';':
  536.             goto command; /* Lattice will complain about this line! */
  537.          case '<':
  538.             if (redir_fp) {
  539.                fclose(redir_fp);
  540.                redir_fp = NULL;
  541.             }
  542.             redir_fp = fopen(stpblk(cmd+1),"r");
  543.             if (redir_fp == NULL)
  544.                fprintf(console,"Can't open file %s!\n",stpblk(cmd+1));
  545.             goto command;
  546.          case 'Q':
  547.             abort("Bye!");
  548.          case '?':
  549.          case 'H':
  550.          default:
  551.             AvailableCommands();
  552.             goto command;
  553.       }
  554.    }
  555. }
  556.  
  557. ill_cmd()
  558. {
  559.    fputs("Unknown command!\n",console);
  560. }
  561.  
  562. float cnvf(i)
  563. int i;
  564. {
  565.    union kludge n;
  566.  
  567.    n.i = i;
  568.    n.i = SPTieee(n.i);
  569.    return (n.f);
  570. }
  571.  
  572.  
  573. /*-----------------------------------------*/
  574. /* Non-intelligent virtual memory handling */
  575.  
  576. v_pos_line(l)
  577. int l;
  578. {
  579.    if (l < v_starty) {
  580.       if (modified) 
  581.          v_flush();
  582.       v_starty = 0;
  583.       fseek(v_fp,v_offset,0);
  584.       if (want_read)
  585.          fread(v_mand_store,max_x*sizeof(UWORD),max_mem,v_fp);
  586.    }
  587.    if (l-v_starty > max_mem-1) {
  588.       if (modified)
  589.          v_flush();
  590.       v_starty += max_mem;
  591.       fseek(v_fp,(long)(v_starty*max_x*sizeof(UWORD)+v_offset),0);
  592.       if (want_read)
  593.          fread(v_mand_store,max_x*sizeof(UWORD),max_mem,v_fp);
  594.    }
  595. }
  596.  
  597. v_flush()
  598. {
  599.    fseek(v_fp,(long)(v_starty*max_x*sizeof(UWORD)+v_offset),0);
  600.    fwrite(v_mand_store,max_x*sizeof(UWORD),max_mem,v_fp);
  601.    modified = FALSE;
  602. }
  603.  
  604. abort(s)
  605. char *s;
  606. {
  607.    if (cur_resource & F_MATHTRANS)
  608.       CloseLibrary(MathTransBase);
  609.    if (cur_resource & F_MATH)
  610.       CloseLibrary(MathBase);
  611.    if (cur_resource & F_CONSOLE)
  612.       fclose(console);
  613.    if (v_fp)
  614.       fclose(v_fp);
  615.    if (redir_fp)
  616.       fclose(redir_fp);
  617.    if (cur_resource & F_GRAPHICS)
  618.       CloseLibrary(GfxBase);
  619.    if (cur_resource & F_INTUITION)
  620.       CloseLibrary(IntuitionBase);
  621.    if (cur_resource & F_ICON)
  622.       CloseLibrary(IconBase);
  623.    if (cur_resource & F_SETSTORE)
  624.       free(v_mand_store);
  625.    if (cur_resource & F_COLORTAB)
  626.       free(color_table);
  627.  
  628.    CloseDisplay();
  629.  
  630.    puts(s);
  631.    exit(0);
  632. }
  633.  
  634.  
  635. SetPresets(preset)
  636. {
  637.    /* these are some common defaults, preset here to avoid repetitive
  638.     * assignments in the case statements below.  Feel free to override
  639.     * any of these defaults with your own in the case statements below
  640.     */
  641.    max_x = 320;
  642.    max_y = 200;
  643.    max_count = 29;
  644.    color_inc = 1;
  645.    color_set = 1;
  646.    color_mode = 1;
  647.    color_div = 1;
  648.    func_num = 0;
  649.  
  650.    switch (preset)
  651.       {
  652.       case 0:
  653.          fputs("Mandelbrot's Set\n", console);
  654.          start_r.f = -2.85;
  655.          end_r.f = 2.85;
  656.          start_i.f = -2.05;
  657.          end_i.f = 2.05;
  658.          max_count = 15;
  659.          color_offset = 91;
  660.          break;
  661.       case 1:
  662.          fputs("Unbounded Rhythms\n", console);
  663.          start_r.f = 1.703418;
  664.          end_r.f = 2.016930;
  665.          start_i.f = -0.169450;
  666.          end_i.f = 0.169450;
  667.          color_offset = 31;
  668.          break;
  669.       case 2:
  670.          fputs("RJ's Gangliactic\n", console);
  671.          start_r.f = 1.937821;
  672.          end_r.f = 1.945044;
  673.          start_i.f = -0.00259;
  674.          end_i.f = 0.00259;
  675.          color_offset = 31;
  676.          break;
  677.       case 3:
  678.          fputs("Mandelbrot Recursion\n", console);
  679.          start_r.f = -0.294473;
  680.          end_r.f = -0.288444;
  681.          start_i.f = 0.012677;
  682.          end_i.f = 0.014839;
  683.          color_offset = 26;
  684.          max_count = 90;
  685.          break;
  686.       case 4:
  687.          fputs("Crackle\n", console);
  688.          start_r.f = 0.225;
  689.          end_r.f = 0.275;
  690.          start_i.f = 0.8425;
  691.          end_i.f = 0.8525;
  692.          color_offset = 61;
  693.          max_count = 31;
  694.          break;
  695.       case 5:
  696.          fputs("Connections\n", console);
  697.          start_r.f = 0.115206;
  698.          end_r.f = 0.168190;
  699.          start_i.f = -1.036059;
  700.          end_i.f = -0.985386;
  701.          color_offset = 76;
  702.          color_inc = 2;
  703.          break;
  704.       default:
  705.         fputs("SORRY:  there's not that many presets!\n",console);
  706.         break;
  707.       }
  708.    
  709.    ZoomCenterX = max_x >> 1;
  710.    ZoomCenterY = max_y >> 1;
  711.    ZoomBoxSizeX = max_x;
  712.    ZoomBoxSizeY = max_y;
  713.    start_r.i = SPFieee(start_r.i);
  714.    end_r.i = SPFieee(end_r.i);
  715.    start_i.i = SPFieee(start_i.i);
  716.    end_i.i = SPFieee(end_i.i);
  717.    max_mem = max_mem_y * MAXX / max_x;
  718.    init_colors();
  719. }
  720.